<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>用户管理</title>
<s:include value="/app_common/common.jsp"></s:include>
<!-- 日期选择框start -->
<script type="text/javascript" src="<s:property value='webctx'/>/libs/js/form/datePicker/WdatePicker.js"></script>
<!-- 日期选择框end -->
<!--数字分页start-->
<script type="text/javascript" src="<s:property value='webctx'/>/libs/js/nav/pageNumber.js"></script>
<!--数字分页end-->
</head>
<body>
<form name="form1" id="form1" action="<s:property value='webctx'/>/user/user_queryUser.action" method="post">
<div class="box2" panelTitle="功能面板">
	<fieldset>
		<legend>查询</legend>
		<table class="noclass" style="width: 100%">
			<tr>
				<td>用户编码:</td>
				<td><input type="text" name="user.u_code" value="<s:property value='user.u_code'/>"/></td>
				<td>姓名:</td>
				<td><input type="text" name="user.u_name" value="<s:property value='user.u_name'/>"/></td>
				
			</tr>
			<tr>
				<td>账户名:</td>
				<td><input type="text" name="user.u_login_id" value="<s:property value='user.u_login_id'/>"/></td>
				<td>入职时间:</td>
				<td><input type="text" name="user.u_entry_date" value="<s:property value='user.u_entry_date'/>" class="date" style="cursor: pointer;"/></td>
			</tr>
			<tr>
				<td>性别:</td>
				<td colspan="2">
					<select id="u_sex" name="user.u_sex">
					    <option value="-1">--请选择--</option>
					    <option <s:property value="user.u_sex==0?'selected':''"/> value="0">男</option>
					    <option <s:property value="user.u_sex==1?'selected':''"/> value="1">女</option>
					</select>
				</td>
			</tr>
			<tr>
				<td colspan="4" align="center" >
					<button type="button" onclick="resets()"><span class="icon_reload">重置</span></button>&nbsp;
					<button type="button" onclick="search()"><span class="icon_find">查询</span></button>
				</td>
			</tr>
		</table>
	</fieldset>
</div>
<div class="box_tool_min padding_top2 padding_bottom2 padding_right5">
	<div class="center">
		<div class="left">
			<div class="right">
				<div class="padding_top5 padding_left10">
					<a href="javascript:;" onclick="onInsert()"><span class="icon_add">新增用户</span></a>
					<div class="box_tool_line"></div>
					<a href="javascript:;" onclick="onDelete(null)"><span class="icon_delete">批量删除</span></a>
					<!-- 
					<div class="box_tool_line"></div>
					<a href="javascript:;" onclick="importUser()"><span class="icon_import">导入</span></a>
					<div class="box_tool_line"></div>
					<a href="javascript:;" onclick="exportUser()"><span class="icon_export">导出当前页</span></a>
					<div class="box_tool_line"></div>
					<a href="javascript:;"  onclick="exportUser2()"><span class="icon_export">导出全部</span></a> -->
					<div class="clear"></div>
				</div>
			</div>
		</div>
	</div>
	<div class="clear"></div>
</div>
<div id="scrollContent" >
	<table class="tableStyle" id="tableA" useClick="false" headFixMode="true" useCheckBox="true" sortMode="true">
		<tr>
			<th width="25"></th>
			<th width="80"><span  id="span_userName">用户编码</span></th>
			<th width="80"><span  id="span_userName">姓名</span></th>
			<th width="100"><span id="span_userLoginName">登陆名</span></th>
			<th width="25"><span id="span_userSex">性别</span></th>
			<th width="60"><span  id="span_userEmployTime">入职时间</span></th>
			<th width="60"><span>离职时间</span></th>
			<th width="100"><span>所属角色</span></th>
			<th width="100"><span>所属部门</span></th>
			<th width="60"><span>出生日期</span></th>
			<th width="50"><span>学历</span></th>
			<th><span>家庭住址</span></th>
			<th width="50"><span>级别</span></th>
			<th width="50"><span>状态</span></th>
			<th width="80">操作</th>
		</tr>
		<s:iterator value="page.result" status="stat">
		<tr ondblclick="onView(<s:property value="u_id"/>)">
			<td width="25"><input name="keys" type="checkbox" value="<s:property value="u_id"/>" /></td>
			<td width="80"><s:property value="u_code"/></td>
			<td width="80"><s:property value="u_name"/></td>
			<td width="100"><s:property value="u_login_id"/></td>
			<td width="25"><s:property value="u_sex==0?'男':'女'"/></td>
			<td width="60"><s:property value="u_entry_date"/></td>
			<td width="60"><s:property value="u_entry_date_end==null||u_entry_date_end==''?'无':u_entry_date_end"/></td>
			<td width="100"><s:property value="u_role_name"/></td>
			<td width="100"><s:property value="u_ltd_name"/></td>
			
			<td width="60"><s:property value="u_cs_date"/></td>
			<td width="50"><s:property value="@com.japp.tools.common.SelectVal@userXl(u_xl)"/></td>
			<td title="<s:property value='u_address'/>"><s:property value="u_address.length()>10?u_address.substring(0,10)+'……':u_address"/></td>
			<td width="50"><s:property value="u_power==1?'营业部':u_power==2?'分部':'普通'"/></td>
			<td width="50"><s:property value="u_status==1?'在职':'离职'"/></td>
			<td width="80">
				<span class="img_view hand" title="查看" onclick="onView(<s:property value="u_id"/>)"></span>
				<span class="img_edit hand" title="修改" onclick="onEdit(<s:property value="u_id"/>)"></span>
				<span class="img_delete hand" title="删除" onclick="onDelete(<s:property value="u_id"/>)"></span>
			</td>
		</tr>
		</s:iterator>
	</table>
</div>
<!-- 分页 -->
<div style="height:35px;">
	<div class="float_left padding5">共查询<s:property value='total'/>条数据</div>
	<div class="float_right padding5">
		<div class="pageNumber" total="<s:property value='total'/>" page="<s:property value='currentPage-1'/>" pageSize="<s:property value='size'/>" showSelect="true" showInput="true" id="page"></div>
	</div>
	<div class="clear"></div>
</div>
<s:hidden name="currentPage"/>
<s:hidden name="size"/>
</form>
</body>
<script type="text/javascript">
//分页事件
$("#page").bind("pageChange",function(e,index){
	$('#currentPage').val(index+1);
	document.form1.submit();
}).bind("sizeChange",function(e,num){
	$('#size').val(num);
	document.form1.submit();
});
//搜索
function search(){
	document.form1.submit();
}
//重置
function resets(){
	$('.noclass input').val('');
	var opt = $('#u_sex option:eq(0)');
	opt.attr('selected',true);
	$('.noclass .selectbox').val(opt.text());
}
//查看
function onView(obj){
	top.Dialog.open({URL:webctx+"/user/user_findUserView.action?user.u_id="+obj,Title:"用户信息查看",Width:505,Height:400}); 
}
//新增
function onInsert(){
	top.Dialog.open({URL:webctx+"/user/user_findUserDetil.action?user.u_id=0",Title:"用户信息新增",Width:505,Height:450});
}
//修改
function onEdit(obj){
	top.Dialog.open({URL:webctx+"/user/user_findUserDetil.action?user.u_id="+obj,Title:"用户信息更新",Width:505,Height:450});
}
//删除
function onDelete(obj){
	top.Dialog.confirm("确定要删除该记录吗？",function(){
		var actionUrl;
		//单个删除
		var actionData = "rnd:"+Math.random();
		if(obj!=null){
			actionUrl = webctx+"/user/user_deleteUserById.action?keys="+obj;
		}else {
			if($('input[name="keys"]:checked').length==0){
				top.Dialog.alert("请选择需要删除的用户!");
				return false;
			}
			actionUrl = webctx+"/user/user_deleteUserById.action";
			actionData = $("#form1").serialize();
		}
		$.ajax({
			url:actionUrl,
			data:actionData,
			type : "post",
			cache : false,
			dataType : 'text',
			success : function(data) {
				alert(data);
				if(data.indexOf('失败')!=-1)return false;
				document.form1.submit();
			}
		});
	});
}

</script>
</html>